package com.hui.mapper;



import com.hui.entity.Menu;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Description
 */
public class MenuMapper implements RowMapper<Menu> {
    @Override
    public Menu rowToEntity(ResultSet rs) {
        Menu menu = null;
        try {
            int menuId = rs.getInt("menu_id");
            String menuCode = rs.getString("menu_code");
            String menuName = rs.getString("menu_name");
            int menuOrder = rs.getInt("menu_order");
            int menuLevel = rs.getInt("menu_level");
            String menuIcon = rs.getString("menu_icon");
            String parentMenuCode = rs.getString("parent_menu_code");
            String menuUrl = rs.getString("menu_url");
            int menuState = rs.getInt("menu_state");

            menu = new Menu(menuId, menuCode, menuName, menuOrder, menuLevel, menuIcon, parentMenuCode, menuUrl, menuState);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return menu;
    }
}
